/**
 * 
 */
package com.jm88.${artifactIdPrefix};

import javax.naming.NamingException;

import org.springframework.mock.jndi.SimpleNamingContextBuilder;

/**
 * 
 * @author xurong
 */
public class JndiMockUtils {
    private static SimpleNamingContextBuilder contextBuilder = null;
    static {
        try {
            contextBuilder = SimpleNamingContextBuilder.emptyActivatedContextBuilder();
        } catch (NamingException e) {
            throw new RuntimeException("mock JNDI 失败", e);
        }
    }

    public static void bind(String jndiName, Object obj) {
        contextBuilder.bind(jndiName, obj);
    }
}
